<template>
    <div class="mainDiv">
      <div class="content">
        <h1 class="title">{{news.title}}</h1>
        <div class="meta">{{news.time|formatDate}}</div>
        <div v-html="news.content"></div>
      </div>
    </div>
</template>

<script>
    import { formatDate } from '@/assets/commonUtil.js'
    export default {
        name: "news",
        data(){
          return {
            news:{}
          }
        },
        filters:{
          formatDate(time) {
            var date = new Date(time);
            return formatDate(date, 'yyyy-MM-dd');
          }
        },
        methods:{
        },
        mounted(){
          if(this.$route.params.id){
            var vm = this;
            this.$http.get('/wx/news/'+this.$route.params.id).then((resp)=>{
                this.news = resp.data;
              }
            )
          }
        }
    }
</script>

<style scoped>
    .title{
      text-align: center;
      word-break: break-word!important;
      word-break: break-all;
      margin: 20px 20px 0;
      font-family: -apple-system,SF UI Display,Arial,PingFang SC,Hiragino Sans GB,Microsoft YaHei,WenQuanYi Micro Hei,sans-serif;
      font-size: 24px;
      font-weight: 700;
      line-height: 1.3;
    }
    .meta{
      margin-top: 5px;
      font-size: 14px;
      color: #969696;
      text-align: center;
    }
</style>
